package com.xsir.ditan.admin.controller;

import com.xsir.ditan.miniprogram.service.ICertificateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author user
 * @date 2021/2/9
 */
@Slf4j
@Controller
@RequestMapping("check")
public class CheckController extends BaseController{
    
    @Autowired
    private ICertificateService certificateService;
    
    @PostMapping("/list")
    @ResponseBody
    public Map<String,Object> list() {
        return certificateService.getList();
    }
    
    @PostMapping("/setStatus")
    @ResponseBody
    public Map<String,Object> setStatus(@RequestBody Map<String, String> map ) {
        Integer id = Integer.valueOf(map.get("id"));
        String statusText = map.get("status");
        Integer status = "1".equals(statusText) ? 3 : 1;
        return certificateService.setStatus(id, status);
    }
}



